<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>检查一个扩展是否已经加载</title>
 </head>
 <body class="docs"><div id="layout">
  <div id="layout-content"><div id="function.extension-loaded" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">extension_loaded</h1>
  <p class="verinfo">(PHP 4, PHP 5, PHP 7)</p><p class="refpurpose"><span class="refname">extension_loaded</span> &mdash; <span class="dc-title">检查一个扩展是否已经加载</span></p>

 </div>
 
 <div class="refsect1 description" id="refsect1-function.extension-loaded-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>extension_loaded</strong></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$name</code></span>
   ) : <span class="type">bool</span></div>

  <p class="para rdfs-comment">
   检查一个扩展是否已经加载。
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.extension-loaded-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>

    
     <dt>
<code class="parameter">name</code></dt>

     <dd>

      <p class="para">
       扩展名称，大小写不敏感。
      </p>
      <p class="para">
       你可以用 <span class="function"><a href="phpinfo.html" class="function">phpinfo()</a></span> 来查看一系列扩展名称，而在 <em>CGI</em> 或 <em>CLI</em> 的 PHP 版本里你可以使用 <strong class="option unknown">-m</strong>
 参数来列出所有有效的扩展：
       <div class="example-contents screen">
<div class="cdata"><pre>
$ php -m
[PHP Modules]
xml
tokenizer
standard
sockets
session
posix
pcre
overload
mysql
mbstring
ctype

[Zend Modules]
</pre></div>
       </div>
      </p>
     </dd>

    
   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.extension-loaded-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   如果 <code class="parameter">name</code> 指定的扩展已加载，返回<strong><code>TRUE</code></strong>，否则返回 <strong><code>FALSE</code></strong>。
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.extension-loaded-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-492">
   <p><strong>Example #1 <span class="function"><strong>extension_loaded()</strong></span> 例子</strong></p>
   <div class="example-contents">
<div class="phpcode"><pre><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">if&nbsp;(!</span><span style="color: #0000BB">extension_loaded</span><span style="color: #007700">(</span><span style="color: #DD0000">'gd'</span><span style="color: #007700">))&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(!</span><span style="color: #0000BB">dl</span><span style="color: #007700">(</span><span style="color: #DD0000">'gd.so'</span><span style="color: #007700">))&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;exit;<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br />}<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</pre></div>
    </div>

   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.extension-loaded-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="function"><a href="get_loaded_extensions.html" class="function" rel="rdfs-seeAlso">get_loaded_extensions()</a> - 返回所有编译并加载模块名的 array</span></li>
    <li class="member"><span class="function"><a href="get_extension_funcs.html" class="function" rel="rdfs-seeAlso">get_extension_funcs()</a> - 返回模块函数名称的数组</span></li>
    <li class="member"><span class="function"><a href="phpinfo.html" class="function" rel="rdfs-seeAlso">phpinfo()</a> - 输出关于 PHP 配置的信息</span></li>
    <li class="member"><span class="function"><a href="dl.html" class="function" rel="rdfs-seeAlso">dl()</a> - 运行时载入一个 PHP 扩展</span></li>
    <li class="member"><span class="function"><a href="function_exists.html" class="function" rel="rdfs-seeAlso">function_exists()</a> - 如果给定的函数已经被定义就返回 TRUE</span></li>
   </ul>
  </p>
 </div>


</div></div></div></body></html>